package com.kgc.polym.demo3;

public class Test {
    public static void main(String[] args) {
        MyObject myObject = new MyObject();
        System.out.println(myObject);

        //Object类中equals(Object anObject)用来判断两个对象是否是同一个对象(内存地址是否相等)
        //String类重写了Object父类equals(Object anObject)，用来判断两个字符串对象的内容是否相等
       /* if(str1.equals(str2)){
            System.out.println("两个字符串对象的值相等。");
        }
        else{
            System.out.println("两个字符串对象的值不相等。");
        }*/

        Student stu1= new Student(1000,"张三",19);
        Student stu2= new Student(1000,"张三",19);
        System.out.println(stu1 == stu2);  //false
        System.out.println(stu1.equals(stu2)); //true

        System.out.println(stu1.hashCode());
        System.out.println(stu2.hashCode());
    }
}
